<% layout('/layouts/default.html', {title: '任务部署信息表(主)管理', libs: ['validate','fileupload','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<#form:form id="searchForm" model="${dcSupTaskInfo}" action="${ctx}/home/homePage/listData?id=${dcSupTaskAction.id}&taskLeader=${dcSupTaskAction.taskLeader}" method="post" class="form-horizontal">
		<div class="box-body">
			<div style="text-align: left">
				<button type="button" class="btn btn-default btn-sm ml10" onclick="js.closeCurrentTabPage()" style="background: #FFF;border: 1px solid #DCDFE6;color: #606266;">${text('关 闭')}</button>
			</div>
			<div class="row">
				<div class="form-unit">${text('任务详细信息')}</div>
				<!--基本任务信息------------>
				<div class="row">
					<div class="col-xs-3">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('任务年度')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label">${dcSupTaskInfo.taskYear}</label>
							</div>
						</div>
					</div>
					<div class="col-xs-3">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('任务类型')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label">${dcSupTaskInfo.taskTypeName}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-3">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('发起单位')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label" style="text-align: left">${dcSupTaskInfo.createOrgName!'无'}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-1" title="">
								<span class="required hide">*</span> ${text('任务标题')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-11">
								<label class="control-label" style="text-align: left">${dcSupTaskInfo.taskTitle}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-1" title="">
								<span class="required hide">*</span> ${text('任务内容')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-11">
								<label class="control-label" style="text-align: left">${dcSupTaskInfo.taskContent}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-3">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('发布时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label" style="text-align: left">${dcSupTaskInfo.createDate,"yyyy-MM-dd HH:mm"}</label>
							</div>
						</div>
					</div>
				</div>
			</div>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</#form:form>
	</div>
</div>
<% } %>

<script>
	// 初始化DataGrid对象
	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		sortableColumn: false, // 列表不允许排序
		columnModel: [
			{header:'${text("任务内容")}', name:'taskContent', index:'a.task_content', width:150, align:"left"},
			{header:'${text("牵头责任单位")}', name:'leaderOrgName', index:'a.leader_org_name', width:150, align:"center"},
			{header:'${text("进展情况")}', name:'taskStatus', index:'a.task_status', width:150, align:"center"
				,formatter: function(val, obj, row, act){
					if(val=='1'){
						return '<a  onclick=showProgress("'+row.id+'","'+row.leaderOrgName+'") ><img src="${ctxStatic}/m/images/4-1.png"></a>';
					}else if(val=='2'){
						return '<a onclick=showProgress("'+row.id+'","'+row.leaderOrgName+'")><img src="${ctxStatic}/m/images/4-2.png"></a>';
					} else if(val=='3'){
						return '<a onclick=showProgress("'+row.id+'","'+row.leaderOrgName+'")><img src="${ctxStatic}/m/images/4-3.png"></a>';
					} else if(val=='4'){
						return '<a onclick=showProgress("'+row.id+'","'+row.leaderOrgName+'")><img src="${ctxStatic}/m/images/4-4.png"></a>' ;
					}else{
						return '未知';
					}


				}
			},
			{header:'${text("当前状态")}', name:'remarks2', index:'a.task_status', width:150, align:"center", frozen:true,formatter: function(val, obj, row, act){

					return js.getDictLabel(${@DictUtils.getDictListJson('dc_task_action_status')}, val, '${text("未知")}', true);
				}}
			// 	,
			// {header:'${text("操作")}', name:'actions', width:120, align:"center",formatter: function(val, obj, row, act){
			// 		var actions = [];
			// 		if(row.explainContent == ''||row.explainContent ==null){
			// 			actions.push('<a style="cursor:pointer;"  onclick=clickTwo("'+row.id+'","'+row.taskLeader+'")  title="${text("批示")}" ><span class="btn btn-primary btn-xs">批示</span></a>');
			// 		} else {
			// 			actions.push("<a href = 'javascript:js.alert(\""+row.explainContent+"\");'>查看</a>");
			// 		}
			// 		return actions.join('');
			// 	}}
		],

		ajaxSuccess: function(data){

		}
	});

	// 批示
	function clickTwo(id,taskLeader){
		js.layer.open({
			type: 2,
			title: ['领导批示'],
			area: ['800px', '400px'],
			scrollbar: true,
			shadeClose: false,
			content: "${ctx}/home/homePage/form?actionId="+id+"&explainCode="+taskLeader,
			btn1: function (index, layero) {
			},
			end:function () {
				$('#dataGrid').dataGrid('refresh', 1, 20);
			}
		});
	}

	//展示进展情况
	function showProgress(id,org){
		js.layer.open({
			type: 2,
			title: ['进展情况'],
			area: ['800px', '400px'],
			scrollbar: true,
			shadeClose: false,
			content: "${ctx}/status/dcSupTaskStatus?targetId="+id+"&remarks4="+org,
			btn1: function (index, layero) {
			},
			end:function () {
				$('#dataGrid').dataGrid('refresh', 1, 20);
			}
		});
	}
</script>
